﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.Practices.Unity;
using Vit.Common;

namespace Vit.Web
{
    public class UnityWebApplication : System.Web.HttpApplication
    {
        protected virtual void Application_Start(object sender, EventArgs e)
        {
            IUnityContainer parentContainer = new UnityContainer();
            IUnityContainer childContainer = SetupUnityContainer(parentContainer);
            WebUnity.Current = new WebUnity(childContainer);
        }

        protected virtual void Application_End(object sender, EventArgs e)
        {
        }
        protected virtual void Application_Error(object sender, EventArgs e)
        {
        }

        protected virtual void Application_BeginRequest(object sender, EventArgs e)
        {
        }

        protected virtual void Application_EndRequest(object sender, EventArgs e)
        {
        }

        protected virtual void Session_Start(object sender, EventArgs e)
        {
        }

        protected virtual void Session_End(object sender, EventArgs e)
        {
        }

        protected virtual IUnityContainer SetupUnityContainer(IUnityContainer unity)
        {
            return unity;
        }
    }
}
